﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.ApplicationModel.Bootstrap.Extensibility;
using YasharEl.Infrastructure.ApplicationModel.Bootstrap.Syntax;
using YasharEl.Infrastructure.ApplicationModel.Bootstrap.Behavior;

namespace YasharEl.Infrastructure.ApplicationModel.Bootstrap
{
    /// <summary>
    /// Strategy which tells the bootstrapper how to boot up the simple scenario.
    /// </summary>
    public class SimpleBootstrappingStrategy : AbstractBootstrappingStrategy<ISimpleBootstrappingExtension>
    {
        protected override void DefineRunSyntax(ISyntaxBuilder<ISimpleBootstrappingExtension> builder)
        {
            builder
                .Execute(x => x.Start());
        }

        protected override void DefineShutdownSyntax(ISyntaxBuilder<ISimpleBootstrappingExtension> builder)
        {
            builder
                .Execute(x => x.Shutdown())
                .End.With(new DisposeExtensionBehavior());
        }

        protected override void DefineConfigureSyntax(ISyntaxBuilder<ISimpleBootstrappingExtension> builder)
        {
            builder
                .Execute(x => x.Configure());
        }
    }
}
